package com.tianji.promotion.util;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.concurrent.TimeUnit;

import static com.tianji.promotion.util.MyLockType.RE_ENTRANT_LOCK;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MyLock {
    /**
     * 锁的名称
     * */
    String name();
    /**
     * 锁的有效期
     * */
    int leaseTime() default -1;
    int waitTime() default 0;
    TimeUnit unit() default  TimeUnit.SECONDS;

    MyLockType lockType() default RE_ENTRANT_LOCK;
}